package com.soft.mainsite.mybatis.mapper;

import com.soft.mainsite.mybatis.model.TSysOrgUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

/**
 * TSysOrgUserMapper
 *
 * @author Jin
 * @create 2017-06-16
 **/
public interface TSysOrgUserMapper extends Mapper<TSysOrgUser> {

    /**
     * 根据组织id和用户id查询数量
     *
     * @param orgId
     * @param userId
     * @return
     */
    @Select("select count(0) from t_sys_org_user where  org_id =#{orgId} and user_id =#{userId} ")
    int selectCountByOrgIdAndUserId(@Param("orgId") Integer orgId, @Param("userId") Integer userId);

    /**
     * 根据User id删除
     *
     * @param userId
     * @return
     */
    @Delete("delete from t_sys_org_user where user_id =#{userId}")
    int deleteByUserId(@Param("userId") Integer userId);
}